From dc780255c8ec1d7d386d4771b77b335ec2f7c27e Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 18 Jun 2008 04:01:08 +0000 Subject: [PATCH] Read course/speed from Garmin PVT. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@3259 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/garmin.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index f33350e28..0655ba025 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -22,6 +22,7 @@ #include #include #include "defs.h" +#include "grtcirc.h" #include "jeeps/gps.h" #include "garmin_tables.h" #include "garmin_fs.h" @@ -560,8 +561,19 @@ pvt2wpt(GPS_PPvt_Data pvt, waypoint *wpt) wpt->altitude = pvt->alt; wpt->latitude = pvt->lat; - wpt->longitude = pvt->lon; - + wpt->longitude = pvt->lon; + WAYPT_SET(wpt,course,1); + WAYPT_SET(wpt,speed,1); + /* convert to true course in degrees */ + if ( pvt->east >= 0.0 ) + wpt->course = 90 - DEG(atan(pvt->north/pvt->east)); + else + wpt->course = 270 - DEG(atan(pvt->north/pvt->east)); +#if 0 + /* velocity in m/s */ + wpt->speed = sqrt(pvt->north*pvt->north + pvt->east*pvt->east); + wpt->vs = pvt->up; +#endif /* * The unit reports time in three fields: * 1) The # of days to most recent Sun. since 1989-12-31 midnight UTC. -- 2.30.2